<?php


namespace Matrix\Controller;

use Think\Controller;
class OuradminController extends Controller {
	
	public function __construct() {
		parent::__construct ();
	}
	
	function login_check(){
		$username=I("username");
		$password=I("password");
		$dingge_adminModel = D("Ouradmin");
		$where['username']=$username;
		$where['password']=$password;
		if($dingge_adminModel->where($where)->find()){
			session("ssc_ouradmin",$username);
			$this->redirect("Home/Index/index");
		}else {
			$this->display("login");
		}
	}
	
// 	function login(){
// 		$this->display();
// 	}

	function login(){
		$adminModel = D("Ouradmin");
		$where['username']=I('username');
		$where['password']=md5(md5(md5(I('password'))));
		$user = $adminModel->where($where)->field('id,username')->find();
// 		dump($adminModel->_sql());
// 		dump($where);
// 		dump($user);
// 		die();
		if($user){
			session("ssc_ouradmin",$user);
			$this->redirect("Matrix/Index/index");
		}else {
// 			dump(md5('ljhc888'));
// 			dump(md5(md5(md5('op789451'))));
			$this->display("login");
		}
	}
	
	function logout(){
		session("ssc_ouradmin",null);
		$this->display("login");
	}
	
	function google_analytics(){
		$this->display();
	}
	
}